<?php
/*
  $Id$

  osCommerce, Open Source E-Commerce Solutions
  http://www.oscommerce.com

  Copyright (c) 2010 osCommerce

  Released under the GNU General Public License
*/

  class sb_links_plus {
    var $code = 'sb_links_plus';
    var $title;
    var $description;
    var $sort_order;
    var $icon = 'links_plus.png';
    var $enabled = false;

    function sb_links_plus() {
      $this->title = MODULE_SOCIAL_BOOKMARKS_LINKS_PLUS_TITLE;
      $this->public_title = MODULE_SOCIAL_BOOKMARKS_LINKS_PLUS_PUBLIC_TITLE;
      $this->description = MODULE_SOCIAL_BOOKMARKS_LINKS_PLUS_DESCRIPTION;

      if ( defined('MODULE_SOCIAL_BOOKMARKS_LINKS_PLUS_STATUS') ) {
        $this->sort_order = MODULE_SOCIAL_BOOKMARKS_LINKS_PLUS_SORT_ORDER;
        $this->enabled = (MODULE_SOCIAL_BOOKMARKS_LINKS_PLUS_STATUS == 'True');
      }
    }

    function getOutput() {
      global $HTTP_GET_VARS;
      return '

<!-- AddThis Button BEGIN -->
<div class="addthis_toolbox addthis_default_style ">
<a class="addthis_button_preferred_1"></a>
<a class="addthis_button_preferred_2"></a>
<a class="addthis_button_preferred_3"></a>
<a class="addthis_button_preferred_4"></a>
<a class="addthis_button_compact"></a>
<a class="addthis_counter addthis_bubble_style"></a>
</div>
<script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js#pubid=ra-4eb8500b4ae96195"></script>
<!-- AddThis Button END -->  ';
  }
    function isEnabled() {
      return $this->enabled;
    }

    function getIcon() {
      return $this->icon;
    }

    function getPublicTitle() {
      return $this->public_title;
    }

    function check() {
      return defined('MODULE_SOCIAL_BOOKMARKS_LINKS_PLUS_STATUS');
    }

    function install() {
      tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable Google Plus Module', 'MODULE_SOCIAL_BOOKMARKS_LINKS_PLUS_STATUS', 'True', 'Do you want to allow products to be shared through Google Plus?', '6', '1', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");
      tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort Order', 'MODULE_SOCIAL_BOOKMARKS_LINKS_PLUS_SORT_ORDER', '0', 'Sort order of display. Lowest is displayed first.', '6', '0', now())");
    }

    function remove() {
      tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')");
    }

    function keys() {
      return array('MODULE_SOCIAL_BOOKMARKS_LINKS_PLUS_STATUS', 'MODULE_SOCIAL_BOOKMARKS_LINKS_PLUS_SORT_ORDER');
    }
  }
?>
